home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 2000 February
/
Macworld (2000-02).dmg
/
Games World
/
Hot demos!
/
Starbound II
/
AI agents
/
Gypsum 1.00
/
Gypsum 1.00.rsrc
/
ss$t_131
< prev
next >
Wrap
Text File
|
1999-10-30
|
1KB
|
51 lines
situation planetary_bombardment_ship
vars
p : planet;
s : structure;
a : integer;
weakest : structure;
bomb : integer;
success : boolean;
focus : squad;
begin
// First see if the planet is an enemy race
if (Orbit_owner(This_planet()) <> Planet_race(This_planet())) then
begin
// Find a structure on the planet to bombard with the weakest armor
p := This_planet();
weakest := First_structure(p);
if (weakest <> nil) then
begin
s := Next_structure(p, weakest);
while (s <> nil) do
begin
if (Structure_armor(p, s) < Structure_armor(p, weakest)) then
weakest := s;
else if ((Structure_armor(p, s) = Structure_armor(p, weakest)) and
(Random(4) = 0)) then
weakest := s;
s := Next_structure(p, s);
end;
bomb := Structure_hex(p, weakest);
success := Bombard_planet(bomb);
end;
end;
// well, I guess we hunt enemy troops
focus := First_squad(-1);
success := false;
while ((focus <> nil) and (not success)) do
begin
if (Squad_race(focus) <>My_race()) then
begin
success := Bombard_planet(Squad_hex(focus));
end;
focus := Next_squad(focus, -1);
end;
end;